The present invention relates generally to scheduling tasks by an operating system running on multi-core multi-threaded environment and more particularly to measuring a run-time task load on a core with hardware assist and distributing tasks according to a core load in order to balance the load and improve system performance.
Typically, an operating system is executed on a computer system that incorporates a processor chip connected to a logical board via a socket. Computer systems, such as file servers, may have a multi socket configuration where more than one socket is allocated for a chip.
A chip connected via socket, typically, has more than one core. Each core is a separate central processing unit (CPU) that is configured to execute tasks that are managed by the operating system. A task is a basic group of commands that may be executed on a CPU.
Each core in multi-threading environment may be configured to execute several tasks while each task is executed on a separate thread of the same core. A thread may be created by time-slice usage of a single core, thus each thread of a multi-threaded processor appeared to the operating system as a processor.
In order to distribute tasks effectively, the operating system has a scheduling module called a scheduler. Scheduler is a software program that is configured to allocate each task that is scheduled to be executed in a run queue to a thread in a multi-threaded environment. A scheduler uses metrics to estimate a load on a thread by analyzing the length of a run time associated with a task. For example, Linux kernel scheduler uses metrics that accounts for past behavior of a thread when the same task was executed on the thread.